package com.work_attendance.common.utils;

import java.util.Calendar;
import java.util.Date;

public class DateUtils {
    private static Calendar calendar=Calendar.getInstance();

    /**
     * @deprecated 计算当天是星期几
     * @return
     */
    public static int getTodayWeek(){
        calendar.setTime(new Date());
        int week = calendar.get(Calendar.DAY_OF_WEEK)-1;
        if(week<0)
            week=7;
        return week;
    }

    /**
     * @deprecated 计算两个时间的分钟时间差
     * @param startDate
     * @param endDate
     * @return
     */
    public static int getMinute(Date startDate,Date endDate){
        long start=startDate.getTime();
        long end = endDate.getTime();
        return (int)(end-start)/(1000*60);
    }

    /**
     * @deprecated 获取当天的某个时间
     * @param hour
     * @param minute
     * @return
     */
    public static Date getDate(int hour,int minute){
        calendar.set(Calendar.HOUR_OF_DAY,hour);
        calendar.set(Calendar.MINUTE,minute);
        return calendar.getTime();
    }
}
